package com.qiaofang.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

/**
 * 操作日志
 */
@Data
@Entity
@Table(name = "tm_operation_log")
@EntityListeners(AuditingEntityListener.class)
public class OperationLog {

    @Id
    @ApiModelProperty("id")
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty("")
    @Column(name = "opt_target")
    private String optTarget;

    @ApiModelProperty("")
    @Column(name = "opt_target_id")
    private Long optTargetId;

    @ApiModelProperty("")
    @Column(name = "opt_type")
    private String optType;

    @CreatedDate
    @ApiModelProperty("操作时间")
    @Column(name = "opt_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date optTime;

    @CreatedBy
    @ApiModelProperty("操作人")
    @Column(name = "opt_user")
    private Long optUser;

}
